<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>1-ajax简单封装</title>
</head>

<body>
    <ul>

    </ul>

    <script src="./ajax.js"></script>
    <script>
        ajax('http://localhost:8081/prodcuts/A?price=10').then((value) => {
            console.log(value)
            value.forEach((item) => {
                console.log(item)
                let str = 
                `
                ${item.id}--${item.name}--${item.price}
                `
                let li = document.createElement('li')
                li.innerHTML = str
                document.querySelector('ul').appendChild(li)
            })
        }, (error) => {
            console.log(error)
        })


    </script>
</body>

</html>